from mininet.topo import Topo

class MyTopo( Topo ):

	def __init__( self ):

		# initilaize topology   
		Topo.__init__( self )

		s1 = self.addSwitch('s1')
		s2 = self.addSwitch('s2')
		s3 = self.addSwitch('s3')

		h1 = self.addHost('h1', ip='192.168.1.1')
		h2 = self.addHost('h2', ip='192.168.1.2')
		h2_1 = self.addHost('h21', ip='192.168.1.65')
		h2_2 = self.addHost('h22', ip='192.168.1.129')
		server1 = self.addHost('server1', ip='192.168.1.66')
		server2 = self.addHost('server2', ip='192.168.1.67')
		server3 = self.addHost('server3', ip='192.168.1.130')
		server4 = self.addHost('server4', ip='192.168.1.131')

		self.addLink(s1, h1)
		self.addLink(s1, h2)
		self.addLink(s1, s2)
		self.addLink(s1, s3)
		self.addLink(s2, h2_1)
		self.addLink(s3, h2_2)
		self.addLink(s2, server1)
		self.addLink(s2, server2)
		self.addLink(s3, server3)
		self.addLink(s3, server4)


topos = { 'mytopo': ( lambda: MyTopo() ) }


